import os


def deltheMoreJpg():
    directory = "D:/work/images"  # 指定目录路径
    alls = []
    for filename in os.listdir(directory):  # 遍历目录下所有文件
        filename_alls = filename[:-4] + '.txt'
        if filename_alls not in os.listdir(directory):
            os.remove(os.path.join(directory, filename))


def deltheDog():
    directory = "D:/work/images"  # 指定目录路径
    alls = []
    for filename in os.listdir(directory):  # 遍历目录下所有文件
        if filename.islower():
            os.remove(os.path.join(directory, filename))


if __name__ == '__main__':
    deltheMoreJpg()
